package com.uqbar.arkanoid.game;

import java.awt.Color;
import java.awt.Dimension;

import com.uqbar.arkanoid.components.Marcador;
import com.uqbar.arkanoid.components.Pelota;
import com.uqbar.arkanoid.components.Raqueta;
import com.uqbar.arkanoid.imagesComponents.ArkanoidBar;
import com.uqbar.arkanoid.imagesComponents.ShinyBall;
import com.uqbar.arkanoid.scenes.ArkanoidScene;
import com.uqbar.vainilla.DesktopGameLauncher;
import com.uqbar.vainilla.Game;
import com.uqbar.vainilla.arkanoid.endscene.EndScene;

public class ArkanoidGame extends Game {

	@Override
	protected void initializeResources() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void setUpScenes() {
		
		ArkanoidScene escena = this.buildArkanoidScene();
				
		this.setCurrentScene(escena);
		

	}
	
	public ArkanoidScene buildArkanoidScene(){
		ArkanoidScene scene = new ArkanoidScene(this.getDisplayWidth());

		scene.setRaqueta(new Raqueta());
		scene.setPelota(new Pelota(Color.RED,scene.getRaqueta().getX()+40,scene.getRaqueta().getY()-20,scene.getRaqueta()));

		scene.setSkinPelota(new ShinyBall("/BlueBall.png", scene.getPelota().getX(), scene.getPelota().getY()));
		scene.setSkinRaqueta(new ArkanoidBar("/bar.png", scene.getRaqueta().getX(), scene.getRaqueta().getY()));
		scene.llenarDeBloques(10);

		return scene;
	}
	
	public ArkanoidScene buildArkanoidSceneWithMarker(Marcador marker){
		
		ArkanoidScene scene = new ArkanoidScene(this.getDisplayWidth());

		scene.sustituirMarcadorPorMarcador(marker);
		scene.setRaqueta(new Raqueta());
		scene.setPelota(new Pelota(Color.RED,scene.getRaqueta().getX()+40,scene.getRaqueta().getY()-20,scene.getRaqueta()));

		scene.setSkinPelota(new ShinyBall("/BlueBall.png", scene.getPelota().getX()+40, scene.getPelota().getY()-20));
		scene.setSkinRaqueta(new ArkanoidBar("/bar.png", scene.getRaqueta().getX(), scene.getRaqueta().getY()));
		scene.llenarDeBloques(10);

		return scene;
		
	}
	
	public EndScene buildEndScene(Marcador marcador){
		return new EndScene(marcador, this.getDisplayWidth() / 6,
				this.getDisplayHeight() / 10);
	}
	
	

	@Override
	public Dimension getDisplaySize() {
		return new Dimension(800,600);
	}

	@Override
	public String getTitle() {
		return "Arkanoid";
	}
	
	public static void main(String[] args) throws Exception {
		new DesktopGameLauncher(new ArkanoidGame()).launch();
	}

}
